<?php

if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}
require_once( "class_3d/CheckMode_3d.php" );
$gametype = intval(getvar("gametype"));
$chk = new CheckMode_3d($curruser['acl'], 1, $gametype);
$chk->checkShow3dPage();
$g_betname_3or5 = judge_type($gametype, true);
$chkGametype = chkGametype($gametype);
unset($chk);

$tbl = $g_gametype_3d[$gametype]['en'];
$tblName = $g_gametype_3d[$gametype]['ch'];
$ui = new UI_3D(true);
$tpl = new Template2();
$conf = new Config();
if ($curruser['detailed_list'] == 0)
{
    $ui->showErrorPage("<p class=error>你没有权限查阅\会员下注清单！</p>");
    exit();
}
else if ($conf->get("calcbet_{$tbl}") == 1)
{
    $ui->showErrorPage("<p class=error>颁奖过帐中，请稍後再使用本功能！</p>", true);
    exit();
}
require( "class/function_3d.php" );
if ($chkGametype == 3)
{
    require( "class_5h/RateConfig_5h.php" );
    require( "class_5h/MyLotto_5h.php" );
    require( "class_5h/Bet_5h.php" );
    $RateConfig_3d = new RateConfig_5h($gametype);
    $MyLotto_3d = new MyLotto_5h($gametype);
    if ($gametype == 20)
    {
        $_5hFlag = true;
        $_8hFlag = false;
    }
    else
    {
        $_5hFlag = false;
        $_8hFlag = true;
    }
}
elseif ($chkGametype == 4)
{
	require( "class_sb/RateConfig_sb.php" );
    require( "class_sb/MyLotto_sb.php" );
    require( "class_sb/Bet_sb.php" );
    $RateConfig_3d = new RateConfig_sb($gametype);
    $MyLotto_3d = new MyLotto_sb($gametype);
    $_5hFlag = false;
    $_8hFlag = false;
	$g_betname_3or5_tmp=array();
	foreach($g_betname_3or5 as $key=>$val)
	{
		$g_betname_3or5_tmp[$key.'_0']=$val;
	}
	$g_betname_3or5=$g_betname_3or5_tmp;
	unset($g_betname_3or5_tmp);
}
else
{
    require( "class_3d/RateConfig_3d.php" );
    require( "class_3d/MyLotto_3d.php" );
    require( "class_3d/Bet_3d.php" );
    $RateConfig_3d = new RateConfig_3d($gametype);
    $MyLotto_3d = new MyLotto_3d($gametype);
    $_5hFlag = false;
    $_8hFlag = false;
}
$rateNum = 3;
$num = getvar("num");
$bettype = getvar("bettype");
$subid = intval(getvar("subid"));
$xyid = intval(getvar("xyid"));
$xyidStr = "";
if ($bettype !== "")
{
    $bettype = intval($bettype);
    $betsubid = "{$bettype}_{$subid}";
    if ($_5hFlag && in_array($bettype, $g_betXYArr[$gametype]) && in_array($xyid, array(1, 2)))
    {
        $xyidStr = " AND xyid = {$xyid} ";
    }
}
else
{
    $betsubid = "";
}
$page = getvar("page");
$page = $page == "" ? 1 : intval($page);
$agentID = getvar("agent");
$dateS = getvar("dates");
$dateE = getvar("datee");
$lid = getvar("lid");
$lid = $lid == "" ? "" : intval($lid);
$postTime = $conf->get("paper_post_bet");
$today = date("Hi") <= $postTime ? date("Y-m-d", strtotime("-1 day")) : date("Y-m-d");
if ($dateS == "" || $dateE == "" || !is_date($dateS) || !is_date($dateE))
{
    $dateS = $today;
    $dateE = $today;
}
if ($_5hFlag || $_8hFlag)
{
    if ($dateS == $dateE && $dateE == $today)
    {
        $Bet_3d = new Bet_5h($gametype);
    }
    else
    {
        $Bet_3d = new Bet_5h($gametype, "x");
    }
}
else if($chkGametype == 4)
{
	if ($dateS == $dateE && $dateE == $today)
    {
        $Bet_3d = new Bet_sb($gametype);
    }
    else
    {
        $Bet_3d = new Bet_sb($gametype, "x");
    }
}	
else if ($dateS == $dateE && $dateE == $today)
{
    $Bet_3d = new Bet_3d($gametype);
}
else
{
    $Bet_3d = new Bet_3d($gametype, "x");
}
$showUrlFlag = "class=\"span3da\"";
$showNoteTitle02 = "";
$showNoteTitle = "<span>※ 点选会员帐号，可查看<b>该会员</b>於<b>{$tblName}</b>所有的下注清单({$dateS}~{$dateE})。</span>";
$idsWhere = true;
$srcNowShowAcl = intval(getvar("srcNowShowAcl"));
if ($srcNowShowAcl && $agentID != "")
{
    if ($curruser['acl'] <= $srcNowShowAcl)
    {
        diemsg(L_NOACCESSEDIT);
    }
    if ($curruser['acl'] < 255)
    {
        $users = getuserlist($curruser['id'], $srcNowShowAcl);
        if ($users == "")
        {
            diemsg(L_NOTYOURAGENT);
        }
        if (strpos(",{$users},", ",{$agentID},") === false)
        {
            diemsg(L_NOTYOURAGENT);
        }
    }
    $ids = GetUserList($agentID);
}
else if ($agentID != "")
{
    $ids = intval($agentID);
    $showUrlFlag = "";
    $showNoteTitle = "";
    $showNoteTitle02 = " <b>单一会员 所有下注内容</b> ";
    if ($curruser['acl'] != 255)
    {
        switch ($curruser['acl'])
        {
            case 2 :
                $sqlTemp = "SELECT prev_id FROM k_user WHERE id={$ids} LIMIT 0,1";
                break;
            case 3 :
                $sqlTemp = "SELECT a.prev_id FROM k_user a LEFT JOIN k_user b ON ( b.prev_id = a.id) WHERE b.id={$ids}";
                break;
            case 4 :
                $sqlTemp = "SELECT a.prev_id FROM k_user a LEFT JOIN k_user b ON (b.prev_id = a.id) LEFT JOIN k_user c ON (c.prev_id=b.id) WHERE c.id={$ids}";
                break;
            case 5 :
                $sqlTemp = "SELECT a.prev_id FROM k_user a LEFT JOIN k_user b ON (b.prev_id = a.id) LEFT JOIN k_user c ON (c.prev_id=b.id) LEFT JOIN k_user d ON (d.prev_id=c.id)  WHERE d.id={$ids}";
                break;
            default :
                exit("error acl");
                break;
        }
        $rsTemp = getdb($sqlTemp);
        if ($rsTemp->eof)
        {
            $ids = "";
        }
        else if ($rsTemp->f[0] != $curruser['id'])
        {
            $ids = "";
        }
        $rsTemp->close();
    }
}
else
{
    $ids = $Bet_3d->getMyMemberIdByAcl($curruser['id'], $curruser['acl']);
    if ($curruser['acl'] == 255)
    {
        $idsWhere = false;
    }
}
if ($ids != "")
{
    $timeStart = strtotime($dateS . " 00:00:00");
    $timeEnd = strtotime($dateE . " 23:59:59");
    $betRType = intval(getvar("betRType"));
    switch ($betRType)
    {
        case 1 :
            $rameSQLStr = "AND rame = 9 AND (b1 - a1) <= 0 ";
            $rameSQLStr2 = "AND rame = 9 AND (b2 - a2) <= 0 ";
            $rameSQLStr8 = "AND rame = 9 AND (r5 - back) <= 0 ";
            $whereRameSQLStr = "AND a.rame = 9 AND (a.b1 - a.a1) <= 0 ";
            $whereRameSQLStrAll = " AND a.rame = 9 AND (a.b1 - a.a1) <= 0 ";
            $rameTitleStr = " 选项:上缴";
            break;
        case 2 :
            $rameSQLStr = "AND rame = 9 AND (b1 - a1) > 0 ";
            $rameSQLStr2 = "AND rame = 9 AND (b2 - a2) > 0 ";
            $rameSQLStr8 = "AND rame = 9 AND (r5 - back) > 0 ";
            $whereRameSQLStr = "AND a.rame = 9 AND (a.b1 - a.a1) > 0 ";
            $whereRameSQLStrAll = " AND a.rame = 9 AND (a.b1 - a.a1) > 0 ";
            $rameTitleStr = " 选项:得分";
            break;
        default :
            $rameSQLStr = "";
            $rameSQLStr2 = "";
            $rameSQLStr8 = "";
            $whereRameSQLStr = "";
            $whereRameSQLStrAll = " AND a.rame IN (0,9) ";
            $rameTitleStr = " 选项:全部";
            break;
    }
    if ($agentID != "" || $num == "all" || $num == "")
    {
        $rs = $Bet_3d->getMemBetAllList($betsubid, $page, $ids, $timeStart, $timeEnd, $lid, $whereRameSQLStr . $xyidStr, $idsWhere);
    }
    else if ($bettype == "35")
    {
        $numArr = $RateConfig_3d->mystr_split($num, 1);
        $rs = $Bet_3d->getMemBetRList($betsubid, $numArr, $page, $ids, $timeStart, $timeEnd, $lid, $whereRameSQLStr . $xyidStr, $idsWhere);
    }
    else if ($RateConfig_3d->chkG3G6Idx($bettype) == false)
    {
        $rs = $Bet_3d->getMemBetList($betsubid, $num, $page, $ids, $timeStart, $timeEnd, $lid, $whereRameSQLStr . $xyidStr, $idsWhere);
    }
    else
    {
        $rs = $Bet_3d->getMemBetGList($betsubid, $num, $page, $ids, $timeStart, $timeEnd, $lid, $whereRameSQLStr . $xyidStr, $idsWhere);
    }
    $totalrecords = $rs->totalrecords;
    $littleNum = 0;
    $littleAmount = 0;
    $littleBack = 0;
    $littleB1 = 0;
    $ui->header();
    $strTemp = "";
    $strTemp = "<a href=\"javascript:history.back();\">回上一页</a>";
    if ($curruser['acl'] == 255)
    {
        $ipshowFlag = 1;
    }
    else if (intval($conf->Get("ipshow")))
    {
        $ipshowFlag = 1;
    }
    else
    {
        $ipshowFlag = 0;
    }
    echo "<style> .span3da{ color:#0200A0;} </style>";
    echo "<table width=900 border=1 cellpadding=3 cellspacing=0>";
    echo "<thead>";
    echo "<tr class=\"bgImg_{$gametype}\"><th colspan=\"10\" style=\"font-size:13px;text-align:left;padding-left:10px;border-left:0;\"><span style='float:left'>{$tblName} {$showNoteTitle02} 下注清单&nbsp;{$rameTitleStr}&nbsp;{$dateS}～{$dateE}</span><span style=\"text-align:right;float:right\"><a href=\"javascript:window.print()\">列印</a>&nbsp;|&nbsp;{$strTemp}</span></th></tr>";
    echo "<tr class=\"bgClc_{$gametype}\"  align=center><td nowrap>单号 / 时间</td><td nowrap>会员 / 退水</td><td nowrap>盘类 / 期数 / 开奖日期</td><td nowrap>下注内容</td><td nowrap>下注金额</td><td nowrap>赔率</td><td nowrap>退水</td><td nowrap>结果</td><td nowrap>备注</td><td nowrap>IP</td></tr>";
    echo "</thead>";
    echo "<tbody>";
    while (!$rs->eof)
    {
        echo "<tr class=\"td2\">";
        echo "<td nowrap><font color=\"green\">" . $rs->f['id'] . "</font>&nbsp;&nbsp;" . date("m-d H:i:s", $rs->f['createtime']) . "</td>";
        echo "<td nowrap><span {$showUrlFlag} onclick=\"javascript:paper(" . $rs->f['user_id'] . ");\">" . $rs->f['account'] . "</span>&nbsp;&nbsp;<font color=\"green\">" . round(100 - $rs->f['back1'], 2) . "</font></td>";
        echo "<td nowrap>" . $g_disk_name[$rs->f['disk']] . "&nbsp;/&nbsp;" . $rs->f['round'] . "期&nbsp;<font color=\"green\">" . $rs->f['open'] . "</font></td>";
        echo "<td nowrap>";
        if ($_5hFlag)
        {
            echo "<font class='colorXY'>" . $RateConfig_3d->xyidTitle[$rs->f['xyid']] . "</font>";
        }
        echo "【" . $g_betname_3or5[$rs->f['bettype'] . "_" . $rs->f['subid']] . "】&nbsp;" . $RateConfig_3d->getBetContent($rs->f['bettype'],$rs->f['numbers']) . "</td>";//nl2br($rs->f['line_nums'])
        if (20000 < $rs->f['amount'])
        {
            $color = "alert2";
        }
        else if (10000 < $rs->f['amount'])
        {
            $color = "alert1";
        }
        else
        {
            $color = "";
        }
        echo "<td nowrap align=\"right\" class=\"" . $color . "\">" . $rs->f['amount'] . "</td>";
        echo "<td nowrap align=\"right\">" . floatval($rs->f['rate']) . "</td>";
        echo "<td nowrap align=\"right\">" . round($rs->f['a1'], 2) . "</td>";
        echo "<td nowrap align=\"right\">" . say_numbercolor($rs->f['b1'], $rateNum) . "</td>";
        if ($rs->f['rame'] == 1)
        {
            $note = "<font color=red>- 逾时 -</font>";
        }
        else if ($rs->f['rame'] == 2)
        {
            $note = "<font color=red>- 取消 -</font>";
        }
        else if ($rs->f['rame'] == 3)
        {
            $note = "<font color=red>- 异常 -</font>";
        }
        else
        {
            $note = "";
            $littleNum += 1;
            $littleAmount += $rs->f['amount'];
            $littleBack += $rs->f['a1'];
            $littleB1 += $rs->f['b1'];
        }
        if (chkBet_peace($rs->f))
        {
            $note .= " <font class='betpeace'>和局</font>";
        }
        if ($curruser['acl'] == 255)
        {
            $note .= floatval($rs->f['rate5']) ? "<font class=\"c5\" color=\"red\">[" . floatval($rs->f['rate5']) . "]</font>" : "";
        }
        echo "<td nowrap>" . $note . "</td>";
        echo "<td nowrap>" . ( $ipshowFlag ? $rs->f['ip'] : "" ) . "</td>";
        //if ($curruser['account'] == G_SUPERACCOUNT)
        //{
        //    echo "<td nowrap align=\"right\"><a href=\"\">變更</a></td>";
       // }
        echo "</tr>";
        $rs->movenext();
    }
    echo "</tbody>";
    echo "<tfoot>";
    if (1 < $rs->totalpages)
    {
        echo "<tr align=\"right\" class=\"td1\"><td colspan=\"4\">小计 " . $littleNum . " 笔</td><td>" . $littleAmount . "</td><td>--</td><td>" . round($littleBack, 2) . "</td><td>" . say_numbercolor(round($littleB1, $rateNum), $rateNum) . "</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }
    $totalArr = $Bet_3d->getUserSumNumberAmount($ids, $betsubid, $num, $timeStart, $timeEnd, $lid, $whereRameSQLStrAll . $xyidStr, $idsWhere);
    echo "<tr align=\"right\" class=\"td3\"><td colspan=\"4\">总计 " . $totalrecords . " 笔</td><td>" . $totalArr['amount'] . "</td><td>--</td><td>" . round($totalArr['a1'], 2) . "</td><td>" . say_numbercolor(round($totalArr['b1'], $rateNum), $rateNum) . "</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    echo "<tr><td class=\"bgClc_{$gametype}\" colspan=\"10\">" . $rs->pagelink() . "</td></tr>";
    echo "</tfoot>";
    echo "</table>";
    echo $showNoteTitle;
    echo "<script language=\"JavaScript\"> \r\n$(\"tbody tr[class=td2]\").hover(\r\n  function() {\$(this).addClass(\"trover\");}\r\n  , function() {\$(this).removeClass(\"trover\");}\r\n);\r\n</script>\r\n<br />  \r\n";
    echo "<form name=f method=get action='op.php'>";
    echo "<input type=hidden name=op value='agent'> ";
    echo "<input type=hidden name=fp value='betlist_3d'> ";
    echo "<input type=hidden name=agent> ";
    echo "<input type=hidden name=dates value='{$dateS}'> ";
    echo "<input type=hidden name=datee value='{$dateE}'> ";
    echo "<input type=hidden name=gametype value='{$gametype}'> ";
    echo "<input type=hidden name=disTotalFlag value='1'> ";
    echo "<input type=hidden name=betRType value='{$betRType}'> ";
    echo "</form> ";
    echo "<script> ";
    echo "function paper(subid)";
    echo "{";
    if ($showUrlFlag == "")
    {
        echo " return false;";
    }
    else
    {
        echo " f.agent.value = subid; f.submit();";
    }
    echo "\r\n}\r\n</script>";
    if ($dateS == $dateE && $dateE == $today)
    {
        $x = "";
    }
    else
    {
        $x = "x";
    }
    if ($agentID == "" && $dateS == $dateE)
    {
        $sqlBettype = "";
        if ($bettype !== "")
        {
            $sqlBettype = " AND bettype={$bettype} AND subid = {$subid} ";
        }
        $sqlNum = "";
        if ($num != "all")
        {
            if ($_5hFlag)
            {
                $numArr = explode(",", $num);
                switch ($bettype)
                {
                    case "9" :
                        if (count($numArr) != 1)
                        {
                            exit("error number");
                        }
                        $sqlNum = " AND numbers LIKE '{$num}'";
                        break;
                    case "10" :
                        $numArrN = count($numArr);
                        if ($numArrN == 1)
                        {
                            $sqlNum = " AND numbers LIKE '%{$num}%'";
                        }
                        else if ($numArrN == 2)
                        {
                            $sqlNum = " AND numbers LIKE '{$num}'";
                        }
                        else
                        {
                            exit("error number");
                        }
                        break;
                    case "11" :
                    case "12" :
                        $numArrN = count($numArr);
                        if ($numArrN == 1)
                        {
                            $sqlNum = " AND numbers LIKE '%{$num}%'";
                        }
                        else if ($numArrN == 3)
                        {
                            $sqlNum = " AND numbers LIKE '{$num}'";
                        }
                        else
                        {
                            exit("error number");
                        }
                        break;
                    case "13" :
                        $numArrN = count($numArr);
                        if ($numArrN == 1)
                        {
                            $sqlNum = " AND numbers LIKE '%{$num}%'";
                        }
                        else if ($numArrN == 4)
                        {
                            $sqlNum = " AND numbers LIKE '{$num}'";
                        }
                        else
                        {
                            exit("error number");
                        }
                        break;
                    case "14" :
                        $numArrN = count($numArr);
                        if ($numArrN == 1)
                        {
                            $sqlNum = " AND numbers LIKE '%{$num}%'";
                        }
                        else if ($numArrN == 5)
                        {
                            $sqlNum = " AND numbers LIKE '{$num}'";
                        }
                        else
                        {
                            exit("error number");
                        }
                        break;
                    default :
                        $sqlNum = " AND numbers='{$num}'";
                        break;
                }
            }
            else if ($_8hFlag)
            {
                $numArr = explode(",", $num);
                switch ($bettype)
                {
                    case "10" :
                    case "11" :
                    case "12" :
                        $numArrN = count($numArr);
                        if ($numArrN == 1)
                        {
                            $sqlNum = " AND numbers LIKE '%{$num}%'";
                        }
                        else if ($numArrN == 2)
                        {
                            $sqlNum = " AND numbers LIKE '{$num}'";
                        }
                        else
                        {
                            exit("error number");
                        }
                        break;
                    case "13" :
                    case "14" :
                    case "15" :
                        $numArrN = count($numArr);
                        if ($numArrN == 1)
                        {
                            $sqlNum = " AND numbers LIKE '%{$num}%'";
                        }
                        else if ($numArrN == 3)
                        {
                            $sqlNum = " AND numbers LIKE '{$num}'";
                        }
                        else
                        {
                            exit("error number");
                        }
                        break;
                    case "16" :
                        $numArrN = count($numArr);
                        if ($numArrN == 1)
                        {
                            $sqlNum = " AND numbers LIKE '%{$num}%'";
                        }
                        else if ($numArrN == 4)
                        {
                            $sqlNum = " AND numbers LIKE '{$num}'";
                        }
                        else
                        {
                            exit("error number");
                        }
                        break;
                    case "17" :
                        $numArrN = count($numArr);
                        if ($numArrN == 1)
                        {
                            $sqlNum = " AND numbers LIKE '%{$num}%'";
                        }
                        else if ($numArrN == 5)
                        {
                            $sqlNum = " AND numbers LIKE '{$num}'";
                        }
                        else
                        {
                            exit("error number");
                        }
                        break;
                    default :
                        $sqlNum = " AND numbers='{$num}'";
                        break;
                }
            }
            else
            {
                switch ($bettype)
                {
                    case "24" :
                    case "25" :
                    case "26" :
                    case "27" :
                    case "28" :
                    case "30" :
                    case "31" :
                    case "32" :
                    case "33" :
                    case "34" :
                        $sqlNum = " AND numbers LIKE '%{$num}%'";
                        break;
                    case "35" :
                        $numArr = $RateConfig_3d->mystr_split($num, 1);
                        $sqlNum = " AND numbers LIKE '%{$numArr[0]}%,%{$numArr[1]}%,%{$numArr[2]}%'";
                        break;
                    case "46" :
                        if ($num < 6)
                        {
                            $sqlNum = " AND numbers LIKE '{$num},%'";
                        }
                        else if ($num < 12)
                        {
                            $sqlNum = " AND numbers LIKE '%,{$num},%'";
                        }
                        else
                        {
                            $sqlNum = " AND numbers LIKE '%,{$num}'";
                        }
                        break;
                    default :
                        $sqlNum = " AND numbers='{$num}'";
                        break;
                }
            }
        }
        switch ($curruser['acl'])
        {
            case "255" :
                if ($lid == "")
                {
                    $sql = "SELECT count(*) FROM {$x}bet8_{$tbl} WHERE (createtime BETWEEN " . $timeStart . " AND " . $timeEnd . ") {$rameSQLStr8} " . $sqlBettype . $sqlNum . $xyidStr;
                    $sql2 = "SELECT count(*) FROM {$x}bet2_{$tbl} WHERE (createtime BETWEEN " . $timeStart . " AND " . $timeEnd . ") {$rameSQLStr2} " . $sqlBettype . $sqlNum . $xyidStr;
                }
                else
                {
                    $sql = "SELECT count(*) FROM {$x}bet8_{$tbl} WHERE lotto_id={$lid} {$rameSQLStr8} " . $sqlBettype . $sqlNum . $xyidStr;
                    $sql2 = "SELECT count(*) FROM {$x}bet2_{$tbl} WHERE lotto_id={$lid} {$rameSQLStr2} " . $sqlBettype . $sqlNum . $xyidStr;
                }
                $result = $Bet_3d->db->query($sql);
                $row = mysql_fetch_array($result);
                if (0 < $row[0])
                {
                    $betlistUrl = "op.php?op=admin&fp=bet8list_3d&dates=" . $dateS . "&datee=" . $dateE . "&backpage=1&bettype={$bettype}&subid={$subid}&num={$num}&gametype={$gametype}&lid={$lid}&betRType={$betRType}&xyid={$xyid}";
                    echo title("公司 <a href=\"{$betlistUrl}\">走飞清单({$row[0]}笔)<a>", "", 900);
                }
                $result = $Bet_3d->db->query($sql2);
                $row = mysql_fetch_array($result);
                if (0 < $row[0])
                {
                    echo "<br />";
                    $showUrl = "?op=agent&fp=bet2list_3d&bettype={$bettype}&num={$num}&showType=1&dates={$dateS}&datee={$dateE}&bettype={$bettype}&subid={$subid}&gametype={$gametype}&lid={$lid}&betRType={$betRType}&xyid={$xyid}";
                    echo title("下线 <a href=\"{$showUrl}\">走飞清单({$row[0]}笔)</a>", "", 900);
                }
                break;
            default :
                if ($lid == "")
                {
                    $sql = "SELECT count(*) FROM {$x}bet2_{$tbl} WHERE (createtime BETWEEN " . $timeStart . " AND " . $timeEnd . ") {$rameSQLStr2} AND user_id =" . $curruser['id'] . $sqlBettype . $sqlNum . $xyidStr;
                    $sql2 = "SELECT count(*) FROM {$x}bet2_{$tbl} WHERE (createtime BETWEEN " . $timeStart . " AND " . $timeEnd . ") {$rameSQLStr2} AND user_id !=" . $curruser['id'] . " AND uperid" . $curruser['acl'] . " =" . $curruser['id'] . $sqlBettype . $sqlNum . $xyidStr;
                }
                else
                {
                    $sql = "SELECT count(*) FROM {$x}bet2_{$tbl} WHERE lotto_id={$lid} {$rameSQLStr2} AND user_id =" . $curruser['id'] . $sqlBettype . $sqlNum . $xyidStr;
                    $sql2 = "SELECT count(*) FROM {$x}bet2_{$tbl} WHERE lotto_id={$lid} {$rameSQLStr2} AND user_id !=" . $curruser['id'] . " AND uperid" . $curruser['acl'] . " =" . $curruser['id'] . $sqlBettype . $sqlNum . $xyidStr;
                }
                $result = $Bet_3d->db->query($sql);
                $row = mysql_fetch_array($result);
                if (0 < $row[0])
                {
                    $showUrl = "?op=agent&fp=bet2list_3d&bettype={$bettype}&num={$num}&showType=0&dates={$dateS}&datee={$dateE}&bettype={$bettype}&subid={$subid}&gametype={$gametype}&lid={$lid}&betRType={$betRType}&xyid={$xyid}";
                    echo title("本身 <a href=\"{$showUrl}\">走飞清单({$row[0]}笔)</a>", "", 900);
                }
                $temSql = "";
                if (2 < $curruser['acl'])
                {
                    $result = $Bet_3d->db->query($sql2);
                    $row = mysql_fetch_array($result);
                    if (0 < $row[0])
                    {
                        echo "<br />";
                        $showUrl = "?op=agent&fp=bet2list_3d&bettype={$bettype}&subid={$subid}&num={$num}&showType=1&dates={$dateS}&datee={$dateE}&bettype={$bettype}&gametype={$gametype}&lid={$lid}&betRType={$betRType}&xyid={$xyid}";
                        echo title("下线 <a href=\"{$showUrl}\">走飞清单({$row[0]}笔)</a>", "", 900);
                    }
                }
                break;
        }
    }
    $ui->footer();
}
else
{
    $ui->showErrorPage("你的下线无任何会员，或无此会员");
    exit();
}
?>